Skip to content

Select the latest product version in showfor picker if user's version exceeds selectable options #968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LeoMcA opened this issue Nov 29, 2021 · 5 comments
Assignees

Comments

@LeoMcA
Copy link

LeoMcA commented Nov 29, 2021

From: https://bugzilla.mozilla.org/show_bug.cgi?id=1743073

This should be possible with a small tweak to our showfor.js code. For nightly users, the following block gets executed:

if (type === 'version') {
  target = select(this.data.versions[product], val);
  if (target !== null) {
    extra['data-min'] = target.min_version;
    extra['data-max'] = target.max_version;
  }
}

https://github.com/mozilla/kitsune/blob/88701d663c5f0e5d24a9e75794a054e422d0f4da/kitsune/sumo/static/sumo/js/showfor.js#L96-L101

And target becomes null, since (e.g.) fx96 doesn't exist in this.data.versions[product]. We catch that null value below, and return nothing, so the select box just uses the default:

// This will fail if there is no version/product/platform that
// matches the desired val.
if (target === null) {
  return;
}

https://github.com/mozilla/kitsune/blob/88701d663c5f0e5d24a9e75794a054e422d0f4da/kitsune/sumo/static/sumo/js/showfor.js#L110-L114

Here we could instead set target to the most recent version from this.data.versions[product] if val is greater than it (with appropriate guards against conditions like "fx71" < "fx8" returning true). I'm not sure if we can rely on this.data.versions[product] being ordered.

@LeoMcA LeoMcA added the pr-welcome Issues friendly to new contributors. label Nov 29, 2021
@AliceWyman
Copy link

This is still a problem (see https://bugzilla.mozilla.org/show_bug.cgi?id=1830284#c6 for an example).

@AliceWyman
Copy link

This is still a problem. For example, see https://bugzilla.mozilla.org/show_bug.cgi?id=1957915#c1

@akatsoulas akatsoulas removed the pr-welcome Issues friendly to new contributors. label Apr 3, 2025
@akatsoulas akatsoulas self-assigned this Apr 3, 2025
@akatsoulas akatsoulas moved this from 🗄 backlog to 🚀 in progress in Mozilla Support Apr 3, 2025
@akatsoulas
Copy link
Collaborator

PR mozilla/kitsune#6613

@akatsoulas akatsoulas moved this from 🚀 in progress to 📚 review in Mozilla Support Apr 7, 2025
@akatsoulas akatsoulas moved this from 📚 review to 🔎 QA in Mozilla Support Apr 7, 2025
@akatsoulas
Copy link
Collaborator

PR mozilla/kitsune#6614

@emilghittasv
Copy link
Collaborator

I can confirm that this issue is verified fixed in stage.

I'm moving this ticket inside the release column.

@emilghittasv emilghittasv moved this from 🔎 QA to 🚢 release in Mozilla Support Apr 8, 2025
@github-project-automation github-project-automation bot moved this from 🚢 release to ✔ done in Mozilla Support Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants